New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: don't prepare a fix for valid code in key-spacing #15239
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can you also post the after numbers? (In general for perf-related commits we should include a before and after for easier reference later.)
Oh, I posted after only for that rule. Here's a complete output from Before
After
|
Awesome work! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💯
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain:
Improves the performance of
key-spacing
rule.I noticed that
key-spacing
takes significantly more time than other core rules (except forindent
) while linting eslint codebase.What changes did you make? (Give an overview)
It turned out that the rule spends the majоrity of time in calculating data that would be needed to auto-fix invalid code, but isn't needed for valid code, so I moved those lines into the conditional that handles invalid code. This change improved the performance of this rule by ~80%.
Is there anything you'd like reviewers to focus on?